home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-13 / amac44a.zip / COM001.QM < prev    next >
Text File  |  1992-06-22  |  9KB  |  194 lines

  1. *                                com001.qm
  2. *             Macros to Center and Remove Centered Comments
  3. *                        Written By Tom Hogshead
  4. *                       [ See COMTxx.QM For Use ]
  5. *                                 6/16/92
  6. *  Key    Subfile              Description
  7. * =====  =========  =====================================================
  8. *                   Center Macro Comment * -- Comment --*
  9. *  @5                   - Star '*' in Col 5   ( )                         |new
  10. *  @4                   - Star '*' in Col 1
  11. *  @8            -  Convert @4 Comments to @5 Comments                    |new
  12. *  @7            -  Un-Center Comment Made with @4 or @5                  |chg
  13. *
  14. *    {e:\up\COMT*}  Return To COMTxx.QM
  15. *
  16. *-- eoi
  17.  
  18.  
  19. *                            M A C R O S
  20. * ----------------------------------------------------------------------
  21. * @(4) Center macro comment <* -- comment --*>, First Char in in Col 1
  22. * ----------------------------------------------------------------------
  23. * I modified a macro written by Richard Blackburn of SemWare at the
  24. * request of Bob Denhnhardt to comment C programs, to make and center
  25. * macro comment lines.  Type comment beginning in column 1.  Press @4
  26. * to make it a comment line highlighted with dashes.  Comment lines in
  27. * this macro were made with @4.
  28.  
  29. @4      MacroBegin
  30.         setscreenoff setinsmode                                            *|
  31.         setrmargin "72" return      *  Set right margin to 72
  32. * -------------------------- Center Comment --------------------------*
  33.         begline unmarkblock
  34.         dropanchor dropanchor       *  To save our place
  35.         centerline                  *  Center the line
  36. * -------------------------- Complete Line --------------------------*
  37.         gotoblockbeg unmarkblock    *  Un mark it
  38.         cursorleft cursorleft       *  Cursor left twice
  39.         jfalse end                  *  If not end macro, line to long
  40.         markcolumn                  *  Begin block
  41.         begline                     *  Goto beginning of line
  42.         delch delch                 *  Delete ist 2 chars incase Insert on
  43.         "* "                        *  Insert '* space' at col 1
  44.         markcolumn                  *  Close block
  45.         fillblock "-" return        *  Fill with '-'
  46.         copy                        *  Copy to scrap buffer
  47.         endline                     *  Pos at eol to paste
  48.         cursorright                 *  Space over one
  49.         paste  endline "*"          *  Paste block at eol
  50. * ------------------------ Move to Next Line ------------------------*
  51.  END:   begline                     *  Goto start of comment line
  52.         unmarkblock                 *  Un mark it
  53.         cursordown                  *  And move down to next line
  54. *
  55. * 45 bytes Fri  03-29-1991  09:30:22
  56. * 47 bytes Mon  05-04-1992  16:08:27 (TH @4, added setscreenoff *|)
  57.  
  58. * 
  59. * ----------------------------------------------------------------------
  60. * @(5) Center Macro Comment <* -- comment --*>, First Char in Col 5
  61. * ----------------------------------------------------------------------
  62. * This macro centers a macro comment with the first char in col 5.  It
  63. * differs from @4 which has the first char in col 1.
  64.  
  65. * Type comment beginning in col 1, no asterisk.  Press @5 to center it
  66. * and surround with dashes.  Comment lines in this macro were made with
  67. * @5.
  68.  
  69. @5      macrobegin
  70.         setscreenoff setinsmode
  71.         setrmargin "67" return      *  Set right margin to 66
  72.         togglewordwrap
  73.         gotocolumn '58' return
  74.         deltoeol
  75.     * -- 123456789012345678901234567890123456789012345678901234567 --*
  76.     * ------------------------ Center Comment -----------------------*
  77.         begline unmarkblock
  78.         dropanchor dropanchor
  79.         centerline
  80.     * ------------------------ Complete Line ------------------------*
  81.         gotoblockbeg unmarkblock    *  Un mark it
  82.         cursorleft cursorleft       *  Cursor left twice
  83.         jfalse END                  *  If not end macro, line to long
  84.         markcolumn                  *  Begin block
  85.         begline
  86.         delch delch                 *  Delete ist 2 chars in case Insert on
  87.         "* "                        *  Insert '* space' at col 1
  88.         markcolumn                  *  Close block
  89.         fillblock "-" return        *  Fill with '-'
  90.         endline                     *  Pos at eol to paste
  91.         cursorright                 *  Space over one
  92.         unmarkblock markcolumn
  93.         gotocolumn '65' return
  94.         fillblock return
  95.         endline "*"
  96.     * ---------------- Shift Right, Move to Next Line ---------------*
  97.     END:
  98.         unmarkblock
  99.         shiftright shiftright       * Move comment to col 5
  100.         shiftright shiftright
  101.         setrmargin '72' return      * Reset rt margin
  102.         begline cursordown
  103. *
  104. * 73 bytes Mon  06-15-1992  20:42:01 (TH @5, changed @4 to begin in col 5)
  105.  
  106.  
  107.  
  108. * 
  109. * ----------------------------------------------------------------------
  110. * @(7) Un_Center Macro Comment
  111. * ----------------------------------------------------------------------
  112. * This macro removes comments made with @4 and @5.  Comment must not
  113. * contain "--", and must have "* -" as first character in line.  First
  114. * text letter in comment must be in defaultwordset, no * @^ etc.
  115.  
  116.     * ----------------------------- test ----------------------------*
  117.  
  118. @7      MacroBegin
  119.         setscreenoff setinsmode                                          *:15
  120.         unmarkblock
  121.         defaultwordset                  * Set default to find first word
  122.         begline dropanchor
  123.         wordright cursorleft            * Move to space before comment
  124.         dropanchor                      * Close block
  125.         find "* -" return "lb" return   * Test if comment already centered
  126.         jfalse END                      * End macro if not centered
  127.         deleteblock                     * Delete left "* --.." to comment
  128.         markline                        * MarkLine
  129.         find "--" return "l" return     * Find first dashes rt of cmt    *:15
  130.         jfalse end                      * If no dashes, end macro
  131.         unmarkblock markcolumn          *ELSE Mark first dash right of comment
  132.         endline deleteblock             * Delete all right "---*"
  133.  END:
  134.         unmarkblock begline
  135. *
  136. * 47 bytes Wed  04-17-1991  00:28:25
  137. * 49 bytes Tue  08-06-1991  12:41:36 (TH @7, comment cannot have '---')
  138. * 50 bytes Mon  05-04-1992  16:06:42 (TH @7, added setscreenoff v2.15)
  139. * 49 bytes Mon  06-15-1992  20:42:59 (TH @7, shortened)
  140.  
  141. * 
  142. * ----------------------------------------------------------------------
  143. * @(8) Convert @4 Comments to @5 Comments
  144. * ----------------------------------------------------------------------
  145. * This macro will convert comments centered with @4 to comments
  146. * centered with @5.  For example, the following commented centered with
  147. * @4 becomes with @8:
  148.  
  149. * This...
  150.  
  151. * --------------------------- This a Test ---------------------------*
  152.  
  153. * Becomes with @8...
  154.  
  155.     * ------------------------- This a Test -------------------------*
  156.  
  157.  
  158. @8 macrobegin
  159.         setscreenoff setinsmode unmarkblock defaultwordset
  160.         markline endline
  161.         find '* -' return 'lb' return jfalse END
  162.         begline dropanchor wordright cursorleft dropanchor
  163.         find return "lb" return jfalse START:
  164.         deleteblock markline
  165.         find "--" return "l" return jfalse START:
  166.         unmarkblock markcolumn endline deleteblock
  167.     START:
  168.         unmarkblock begline
  169.         setrmargin "67" return togglewordwrap
  170.         gotocolumn "58" return deltoeol
  171.         begline unmarkblock dropanchor dropanchor
  172.         centerline
  173.         gotoblockbeg unmarkblock
  174.         cursorleft cursorleft jfalse SHIFT:
  175.         markcolumn begline delch delch  "* " markcolumn
  176.         fillblock "-" return
  177.         endline cursorright
  178.         unmarkblock
  179.         markcolumn gotocolumn "65" return fillblock return endline "*"
  180.     SHIFT:
  181.         unmarkblock
  182.         shiftright shiftright shiftright shiftright
  183.         setrmargin "72" return
  184.         begline cursordown
  185.     END:
  186.         unmarkblock
  187.         find '--*' return delline return  * Move to next centered cmt line
  188.         begline
  189. *
  190. * 140 bytes Sun  06-21-1992  18:53:52 (TH @8)
  191.  
  192. * ------------------------------- test -------------------------------*
  193.  
  194.